package it.ap.sa.acqua.auth.service.converter;

import org.springframework.stereotype.Component;

import it.ap.sa.acqua.dao.beans.TUserBean;
import it.ap.sa.acqua.dao.model.TUser;
import it.ap.sa.core.util.IBeanPopulate;

/**
 * Converter tra {@link TUser} e {@link TUserBean}
 * @author Alessandro Paolillo
 */
@Component
public class UserConverter implements IBeanPopulate<TUser, TUserBean>{

	public UserConverter() {
	}

	/**
	 * @author Alessandro Paolillo
	 * @see it.eng.tz.core.util.IBeanPopulate#convertdbToPage(java.lang.Object)
	 */
	@Override
	public TUserBean convertdbToPage(TUser src) throws Exception {
		TUserBean result = new TUserBean();
		result.setFirstName( src.getFirstName() );
		result.setLastName( src.getLastName() );
		result.setEmail( src.getEmail() );
		result.setDateBirth( src.getDateBirth() );
		return result;
	}
	
	/**
	 * @author Alessandro Paolillo
	 * @see it.eng.tz.core.util.IBeanPopulate#convertpageToDb(java.lang.Object)
	 */
	@Override
	public TUser convertpageToDb(TUserBean src) throws Exception {
		throw new IllegalArgumentException("Metodo non implementato");
	}

}
